#include<iostream>
using namespace std;


void merge(int A[], int m, int B[], int n) {
    if (m == 0) {
        for (int i = 0; i < n; i++)
            cout << B[i];
        return;
    }
    int i = m - 1;
    int j = n - 1;
    int k = m + n - 1;
    while (i >= 0 && j >= 0) {
        if (A[i] > B[j]) A[k--] = A[i--];
        else A[k--] = B[j--];
    }
    while (j >= 0)  A[k--] = B[j--];
    for (int i = 0; i <m+n; i++)
        cout << A[i];
}

int main()
{
    int a[] = { 1,2,3 };
    int b[] = { 2,5,6 };
    merge(a, 3, b, 3);
    return 0;
}